<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul><li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>


    <script>
        const ulObj = document.querySelector("ul")
        const ulNodes = ulObj.childNodes
        console.log(ulNodes)        //NodeList(7)
        /* 
            明明只有3个li标签，为什么返回的是7个元素？

         */
         console.log(ulNodes[0])    //<li>111</li>
         console.log(ulNodes[1])    // #text 表示的是空行
         console.log(ulNodes[2])    //<li>222</li>
         console.log(ulNodes[3])    // #text

         console.log(ulNodes[0].nodeType)   //1
         console.log(ulNodes[1].nodeType)   //3

         
         /* 
            children:只会返回元素节点
          */
         console.log(ulObj.children)        //HTMLCollection(3) [li, li, li]
         console.log(ulObj.children[0]) 
         console.log(ulObj.children[1]) 
         console.log(ulObj.childElementCount)   //3

    </script>
</body>
</html>